<?php
/**
 * 前台模板切换插件
 *
 * Author：惠达浪
 * Email： crazys@126.com
 */

namespace plugins\crazy_switch_theme;

use cmf\lib\Plugin;

class CrazySwitchThemePlugin extends Plugin
{
    public $info = [
        'name'        => 'CrazySwitchTheme',
        'title'       => '前台模板切换插件',
        'description' => '自由切换已经安装的前端插件',
        'status'      => 1,
        'author'      => '惠达浪',
        'version'     => '1.0.0',
        'demo_url'    => 'https://www.crazys.pub',
        'author_url'  => 'https://www.qdcrazy.cc'
    ];

    public $hasAdmin = 0;

    /**
     * 安装
     * @return bool
     */
    public function install()
    {
        return true;
    }

    /**
     * 卸载
     * @return bool
     */
    public function uninstall()
    {
        return true;
    }

    /**
     * 实现switch_theme钩子方法
     */
    public function switchTheme()
    {
        return session('selected_theme');
    }
}